/**
 * Created by Tim on 2018/8/2.
 */

jQuery(function ($) {

    var approve_btn = $("#add_btn");
    var reject_btn= $("#cancel_btn");
    var back_btn= $("#back_btn");
    var id = $("#id");

    approve_btn.on('click', function () {
        BootBox.confirm('确定要通过该审核？', function (b) {
            if (!b) return;
            SysTool.Ajax.ajaxJsonCall('user_property_dossier/audit/' + id.val(), {status: 1}, function () {
                window.location.href = '/user_property_dossier/';
            });
        });
    });

    reject_btn.on(ace.click_event, function() {
        bootbox.dialog({
            message: "<span class='bigger-110'>清输入驳回原因 : </span><input id='remark' value=''/>",
            buttons:
                {
                    "success" :
                        {
                            "label" : "<i class='icon-ok'></i>确定",
                            "className" : "btn-sm btn-success",
                            "callback": function() {
                                SysTool.Ajax.ajaxJsonCall('user_property_dossier/audit/' + id.val(), {status: 2,remark:$("#remark").val()}, function () {
                                    window.location.href = '/user_property_dossier/';
                                });
                            }
                        },
                    "button" :
                        {
                            "label" : "取消",
                            "className" : "btn-sm",
                            "callback": function() {

                            }
                        }
                }
        });
    });

    back_btn.on("click",function () {
        window.location.href = '/user_property_dossier/';
    });
});